	//마일리지정보
	function clsMyMileage(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();
	}
	
	clsMyMileage.prototype = {
		_init: function(){
			var $layer = $("section#my_mileage>section");
			this._HTMLDom = {
				"$layer": $layer	
			}
			this.setMyBookingAcnt(0);
			this.setMyPoint(0);
		}
		, setMyBookingAcnt: function(val){
			var $layer = this._HTMLDom["$layer"].find("div.my_mileage ul");
			var thisClass = this;
			$layer.find("li:eq(0) div.cont:eq(0)").html(_util.fNum(val));
		}
		, setMyBookingPcnt: function(val){
			var $layer = this._HTMLDom["$layer"].find("div.my_mileage ul");
			var thisClass = this;
			$layer.find("li:eq(1) div.cont:eq(0)").html(_util.fNum(val));
		}
		, setMyPoint: function(val){
			var $layer = this._HTMLDom["$layer"].find("div.my_mileage ul");
			var thisClass = this;
			$layer.find("li:eq(2) div.cont:eq(0)").contents().filter(function(){
				return (this.nodeType==3&&this.data.trim());
			}).after(_util.fNum(val)).remove();			
		}
		, $getBtnMileage: function(){			
			return this._HTMLDom["$layer"].find("div.btn_area05 a");	
		}
	}

	//데이터연동		
	function clsComm_MyMileage(){
		this.my_bookingAcnt = null;
		this.my_bookingPcnt = null;
		this.my_point = null;
		this._init();
	}	
	clsComm_MyMileage.prototype = {
		_init: function(){
			
		}
//------------------------ 가승인수조회------------------------//	
		, getMyBookingAcnt: function(){
			var thisClass = this;
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyPoint");
        		
        	cm.requestGet(objJson.getJsonString(), function(ret){
				
				thisClass.my_bookingAcnt = 0;
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					thisClass.my_bookingAcnt = items;
				}
				
				$(thisClass).trigger("evtFinishMyBookingAcnt");
			}, function($err) {
				alert($err);
			});			
		}
		, getMyBookingAcntData: function(){
			return this.my_bookingAcnt;	
		}
//------------------------ 가승인수조회------------------------//		
//------------------------ 결제완료수조회------------------------//	
		, getMyBookingPcnt: function(){
			var thisClass = this;
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyPoint");
        	        
        	cm.requestGet(objJson.getJsonString(), function(ret){
				
				thisClass.my_bookingPcnt = 0;
				
				var items = ret["msp"]["contents"]["items"];				
				if(items){
					thisClass.my_bookingPcnt= items;					
				}
				
				$(thisClass).trigger("evtFinishMyBookingPcnt");
			}, function($err) {
				alert($err);
			});			
		}
		, getMyBookingPcntData: function(){
			return this.my_bookingPcnt;	
		}
//------------------------ 결제완료수조회------------------------//	
//------------------------ 총적립마일리지조회------------------------//	
		, getMyPoint: function(){
			var thisClass = this;
			
			var objJson = new MJson();
        	var cm = new ConnectionManager();

			objJson.putClient("userid", _util.getLogin("아이디"));
        	objJson.putPub("sid", "US001");
        	objJson.putPub("servicename", "getMyPoint");
        	        
        	cm.requestGet(objJson.getJsonString(), function(ret){
				
				thisClass.my_point = 0;
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					thisClass.my_point = items;
				}
				
				$(thisClass).trigger("evtFinishMyPoint");
			}, function($err) {
				alert($err);
			});			
		}
		, getMyPointData: function(){
			return this.my_point;	
		}
//------------------------ 총적립마일리지조회------------------------//		
	}
	
	//컨트롤파일
	function MyMileage(){				
		this.objComm = null;		
		this.objMyMileage = null;			
	};
	
	MyMileage.prototype = {
	    onPageShow : function() {
	    	//사용자 로그인체크
//	    	if(!document.globalObj.LOGIN_DATA.isLogin){
//	    		alert("로그인 후 사용하시기 바랍니다.");
//	    		return;
//	    	}			
	    	$("a").attr("href", "").attr("data-rel", "");      
	    	this._init();	    		    	
	    }
	    , _init: function(){	    		    	
	    	
	    	this.objComm = new clsComm_MyMileage();
	     	this.objMyMileage = new clsMyMileage();
	     	
	      this.getParam();
	    	
	    	this._role();
	       
	      	this._bind();	   
	      	this._eventFinish();     	   	
	    }
	    , _start: function(){
	    	//가승인결제건 조회
	      	this.objComm.getMyBookingAcnt();
	      	//결제완료건 조회
	      	this.objComm.getMyBookingPcnt();
	      	//총적립마일리지 조회
	      	this.objComm.getMyPoint();
	      	this.spinStart();
	    }
	    , _eventFinish: function(){
	    	var thisClass = this;
	    	
	    	//가승인결제건 조회 완료이벤트
		 	$(this.objComm).bind("evtFinishMyBookingAcnt", function(event){
		 		var thisData = thisClass.objComm.getMyBookingAcntData();
		 		thisClass.objMyMileage.setMyBookingAcnt(thisData);
		 		thisClass.spinEnd();
		 	});
		 	
		 	//결제완료건 조회 완료이벤트
		 	$(this.objComm).bind("evtFinishMyBookingPcnt", function(event){
		 		var thisData = thisClass.objComm.getMyBookingPcntData();
		 		thisClass.objMyMileage.setMyBookingPcnt(thisData);
		 		thisClass.spinEnd();
		 	});
		 	
		 	//총적립마일리지 조회 완료이벤트
		 	$(this.objComm).bind("evtFinishMyPoint", function(event){
		 		var thisData = thisClass.objComm.getMyPointData();
		 		thisClass.objMyMileage.setMyPoint(thisData);
		 		thisClass.spinEnd();
		 	});
	    }
		 , _bind: function(){
		 	var thisClass = this;
		 	
		 	//마일리지상세조회
		 	thisClass.objMyMileage.$getBtnMileage().click(function(event){		 	
		 		event.preventDefault();
		 		$.mobile.changePage("mileage_view.html","slide",true);			 		
		 	});
		 			 	
		 	//메뉴
		 	$("section#my_mileage nav ul li a:eq(0)").click(function(event){
		 		event.preventDefault();
		 		thisClass.goNavi();
		 	});
		 	
		 	//알림
		 	$("section#my_mileage nav ul li:eq(1)").click(function(event){
		 		event.preventDefault();
		 		$.mobile.changePage("../inc/info_booking.html","slide",true);	
		 	});
		 }
		 , getParam: function(){
	    	
	    }
	    , _role: function(){
	    		if(!_util.getLogin("로그인")){
	    			//alert("로그인 후 이용하실 수 있습니다.");		    			
	    			this.goNavi();		
	    			return;
	    		}else {
    				this._start();	    		
    			}
	   }
		, goNavi: function(){			
			$.mobile.changePage("../inc/navi.html","slide",true);
		}
	    , spinStart: function(){		
			$.mobile.showPageLoadingMsg();			
		}
		, spinEnd: function(){			
	 		$.mobile.hidePageLoadingMsg();				
		}
	}	